package com.tianhao.luo.v1.builder;

import com.tianhao.luo.v1.director.Director;
import com.tianhao.luo.v1.product.Product;
import junit.framework.TestCase;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @ClassName: ProductBuilderTest2
 * @Description: 测试建造者模式
 * @author: tianhao.luo@hand-china.com
 * @date: 2020/7/1  14:41
 */
public class ProductBuilderTest2 extends TestCase {
    public static final Logger LOGGER = LoggerFactory.getLogger(ProductBuilderTest2.class);
    @Test
    public void test() {
        // 构造哪种产品找哪个构造者
        ProductBuilder builder = new SpecialConcreateProductBuilder();
        // 构造的具体顺序交给Director类处理，它帮我们与构造者交流，并给我们提供一个产品
        Director director = new Director(builder);
        Product product = director.makeProduct("iPhone11",
                "苹果公司",
                "part1",
                "part2",
                "part3",
                "part4");
        LOGGER.info(product.toString());
    }

}